package com.example.myproject.springdemo.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * Created by Mj on 2018/5/21.
 */
@Aspect
@Component
public class HelloAspect {

    @Pointcut("execution(* com.example.myproject.springdemo.aop.IHelloAop.helloWorld(..) )")
    public void hello() {
    }

    @Before("hello()")
    public void helloBefore() {
        System.out.println("before.......................");
    }

    @Around("hello()")
    public void around(ProceedingJoinPoint point) throws Throwable {

        Object[] objects = point.getArgs();
        System.out.println("heihei");
        point.proceed(objects);
        System.out.println("hah");
    }
}
